<!DOCTYPE html>
<html>
 <head> 
  <meta charset="utf-8" /> 
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> 
  <meta name="renderer" content="webkit" /> 
  <meta name="data-spm" content="a2hcb" /> 
  <meta name="title" content="慕优酷" /> 
  <meta name="keywords" content="慕优酷" /> 
  <meta name="description" content="慕优酷" /> 
  <title>搜索 - 慕优酷</title> 
  <link rel="Shortcut Icon" href="/static/index/img/favicon.ico">
  <link rel="stylesheet" href="/static/index/css/extra.chunk.css" /> 
  <link rel="stylesheet" href="/static/index/css/videolib.chunk.css" /> 
  <script src='/static/index/js/jquery-3.4.1.min.js' type='text/javascript'></script>
 </head> 
 <body>
  <div id="app">
   <div class="app_normal window">
    <div class="g-header_3AdmO white_19Dnq">
    	{{template "header.html" .}}
	</div>
    <div class="videolist_s_body videolist_video_list">
     <div style="margin-top:0">
      
     </div>
     <div>
      <div class="common_container">
       <div class="videolist_container_inner" style="font-size:0;">
	{{range $ind, $elem := .videos}}
        <div class="g-col">
         <div class="g-box">
          <div class="categorypack_yk_pack_v" type="vertical">
           <div class="categorypack_pack_cover">
            <a href="/show?id={{$elem.Id}}" title="{{$elem.Title}}" target="_blank"><img src="{{if eq $elem.Img1 "" }}/static/data/new/38a.png{{else}}{{$elem.Img1}}{{end}}" />
             <div class="categorypack_bg"></div><span class="categorypack_p_rb"><span>{{if ne $elem.IsEnd 1 }}更新至{{$elem.EpisodesCount}}话{{else}}{{$elem.EpisodesCount}}话全{{end}}</span></span></a>
           </div>
           <div class="categorypack_info_list">
            <div class="categorypack_title categorypack_short_title">
             <a href="/show?id={{$elem.Id}}" target="_blank" title="{{$elem.Title}}”">{{$elem.Title}}</a>
            </div>
            <div class="categorypack_subtitle">
             {{$elem.SubTitle}}
            </div>
           </div>
          </div>
         </div>
        </div>
        {{end}}
       
	
	
	
		</div>
      </div>
     </div>
     <div class="fixed_bar_2rZMG">
      <div class="download_wrap_1DeLB"></div>
      <a target="_blank" href="#" class="report_2SyuQ" title="意见反馈"></a>
     </div>
     <div style="margin-bottom:-40px" class="common_container">
      <div class="ad-wrap" id="ab_171" data-areaid="maintitle_9331" data-adpid="171" data-adid="171" data-adtype="" data-adext="inheritHeight" style="height:100px"></div>
     </div>
    </div>
    {{template "foot.html" .}}
   </div>
  </div>
  <input type="hidden" id="currentpage" value="1" />
  <input type="hidden" id="keyword" value="{{.keyword}}" />
 </body>
</html>
<script src='/static/index/js/foot.js' type='text/javascript'></script>
<script>
$(window).scroll(function () {
        var scrollTop = $(this).scrollTop();
        var scrollHeight = $(document).height();
        var windowHeight = $(this).height();
        if (scrollTop + windowHeight == scrollHeight) {
       　　 //此处是滚动条到底部时候触发的事件，在这里写要加载的数据，或者是拉动滚动条的操作
			getVideoData();
　　　　 		console.log("到底了,发起请求")
　　		}
});
function getVideoData(){
	var page = $("#currentpage").val();
	
	var keyword = $("#keyword").val();
	
	$.ajax({
          url: '/search/data',
          data: {
              	page: page,
				keyword: keyword
          },
          type: 'post',
          async: false,
          dataType: 'json',
          success: function(response) {
			console.log(response);
              if (response.code == 0) {
					$.each(response.items,function(i,j){
		        		console.log(i,j);
						var img1 = "/static/data/new/38a.png";
						if(j.Img1 != ''){
							img1 = j.Img1
						}
						
						var end = "更新至"+j.EpisodesCount+"话";
						if(j.IsEnd == 1){
							end = j.EpisodesCount+"话全";
						}
						$(".videolist_container_inner").append('<div class="g-col"><div class="g-box"><div class="categorypack_yk_pack_v" type="vertical"><div class="categorypack_pack_cover"><a href="/show?id='+j.Id+'" title="'+j.Title+'" target="_blank"><img src="'+img1+'" /><div class="categorypack_bg"></div><span class="categorypack_p_rb"><span>'+end+'</span></span></a></div><div class="categorypack_info_list"><div class="categorypack_title categorypack_short_title"><a href="/show?id='+j.Id+'" target="_blank" title="'+j.Id+'”">'+j.Title+'</a></div><div class="categorypack_subtitle">'+j.SubTitle+'</div></div></div></div></div>');
		        	})
					$("#currentpage").val(parseInt(page)+1);
              }
          }
      });
}

getVideoData();

function getQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return unescape(r[2]); return null;
}
    
</script>